<template>
    <div>
        <div @click="cancelRefund">撤销申请</div>
        <confirm ref="confirm" text="撤销后无法再次发起售后，确定撤销申请吗？" confirmText="确定" @confirm="confirmCancel"/>
    </div>
</template>

<script type="text/ecmascript-6">
    import API from '../../request/api'
    import confirm from "../../components/common/confirm";

    export default {
        name: 'cancelRefund',
        components: {confirm},
        props: {
            refundId: {
                type: String
            }
        },
        data() {
            return {};
        },
        methods: {
            cancelRefund() {
                // 撤销申请
                this.$refs.confirm.show();
            },
            confirmCancel() {
                let data = {
                    after_id: this.refundId
                };
                this.request.post(API.closeafter, data).then(res => {
                    this.$toast('撤销成功!');
                    setTimeout(() => {
                        location.reload()
                    }, 1000)
                }, () => {
                });
            }
        }
    };
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
    @import '~assets/main.styl';
</style>
